package com.example.observer;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Risky57 on 2017/4/28.
 */

public class Teacher implements Subject {

    private List<Observer> mObservers = new ArrayList<>();

    @Override
    public void register (Observer observer) {
        mObservers.add(observer);
    }

    @Override
    public void unRegister (Observer observer) {
        mObservers.remove(observer);
    }

    @Override
    public void notifyDataSetChanged (String msg) {
        for (Observer observer : mObservers) {
            observer.notify(msg);
        }
    }
}
